# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=veil
pkgver=297.d8acd4c
pkgrel=6
epoch=5
groups=('blackarch' 'blackarch-automation' 'blackarch-exploitation')
pkgdesc='A tool designed to generate metasploit payloads that bypass common anti-virus solutions.'
url='https://github.com/Veil-Framework/Veil'
arch=('x86_64')
license=('GPL2')
depends=('sudo' 'wine' 'wine-mono' 'wine_gecko' 'git' 'python'
         'python-pycryptodome' 'python-pefile' 'mingw-w64-binutils'
         'mingw-w64-crt' 'mingw-w64-gcc' 'mingw-w64-headers'
         'mingw-w64-winpthreads' 'mono' 'mono-tools' 'python-pip' 'wget' 'unzip'
         'ruby' 'python-capstone' 'ca-certificates' 'metasploit' 'capstone'
         'pyinstaller')
makedepends=('git')
options=('!strip')
source=("$pkgname::git+https://github.com/Veil-Framework/Veil.git"
        'git+https://github.com/Veil-Framework/VeilDependencies.git')
sha512sums=('SKIP'
            'SKIP')
install="$pkgname.install"

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  cp -a "$srcdir/VeilDependencies/"* config/.
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md CHANGELOG
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm CHANGELOG LICENSE README.md

  cp -a * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname/
exec python Veil.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

